// #

// 

const setItem = (key, val) => {
	if (typeof val === 'object') {
		val = JSON.stringify(val)
	}

	uni.setStorageSync(key, val)
}

const getItem = (key) => {

	const data = uni.getStorageSync(key);

	try {
		return JSON.parse(data)
	} catch (e) {
		//TODO handle the exception
		return data
	}

}

const removeItem = (key) => {
	uni.removeStorageSync(key);
}


const clearStorage = () => {
	
	uni.clearStorageSync();
	
	
	
}
export {
	setItem,
	getItem,
	removeItem,
	clearStorage
}
